package com.fengye.swagger2.controller;

import com.fengye.swagger2.dto.PageDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

/* 类注解 */
@Api(value = "desc of class")
@RestController
// @RequestMapping("/hello")
public class HelloController {

    /* 方法注解 */
    @ApiOperation(value = "desc of method", notes = "note for method")
    @GetMapping(value="/hello/test")
    public Object hello( /* 参数注解 */ @ApiParam(value = "desc of param" , required=true ) @RequestParam String name) {
        return "Hello " + name + "!";
    }

    /* 方法注解 */
    @ApiOperation(value = "测试接口", notes = "应该不会被swagger管理的接口")
    @GetMapping(value="/test/hello")
    public Object hello2( /* 参数注解 */ @ApiParam(value = "desc of param" , required=true ) @RequestParam String name) {
        return "Hello " + name + "!";
    }

    /* 方法注解 */
    @ApiOperation(value = "测试接口page", notes = "应该会被swagger管理的接口")
    @PostMapping(value="/hello/page")
    public String page(@RequestBody PageDto pageDto){
        System.out.println(pageDto);
        return "success";
    }
}